class sysinit::sshd {
  
  $allow_root_login = $sysinit::allow_root_login
  
  case $allow_root_login {
    true: {
      $root_login_ensure = 'yes'
    }
    false: {
      $root_login_ensure = 'no'
    }
    default:{
      fail("\${root_login_ensure} only support 'true' or 'false'")
    }
  }
  
  package { 'openssh-askpass':
    ensure => present,
  }
  
  ini_setting {'permitroot':
    section           => '',
    key_val_separator => ' ',
    path              => '/etc/ssh/sshd_config',
    setting           => 'PermitRootLogin',
    value             => $root_login_ensure,
    notify            => Service['sshd'],
    require           => Package['openssh-askpass'],
  }
  
  ini_setting {'usedns':
    section           => '',
    key_val_separator => ' ',
    path              => '/etc/ssh/sshd_config',
    setting           => 'UseDNS',
    value             => 'no',
    notify            => Service['sshd'],
    require           => Package['openssh-askpass'],
  }
  
  service { 'sshd':
    ensure     => running,
    enable     => true,
    hasrestart => true,
    hasstatus  => true,
  }
}